<?php
Util::tsRegisterAssetJs('_form.js')
?>
<div class="form">
    <?php
    /** @var MenuSeccionController $this */
    /** @var MenuSeccion $model */
    /** @var AweActiveForm $form */
    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
        'id' => 'menu-seccion-form',
        'enableAjaxValidation' => true,
        'enableClientValidation' => false,
        'htmlOptions' => array(
            'enctype' => 'multipart/form-data',
        ),
    ));
    ?>

    <p class="note">
        <?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>
        <?php echo Yii::t('AweCrud.app', 'are required') ?>.    </p>

    <?php echo $form->errorSummary($model) ?>

    <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 45)) ?>
      <?php echo $form->labelEx($model, 'cocina'); ?>
     <?php
                            $this->widget(
                                    'bootstrap.widgets.TbToggleButton', array(
                                'model' => $model,
                                'disabledLabel' => 'NO',
                                'enabledLabel' => 'SI',
                                        'enabledStyle'=>'success',
                                        'disabledStyle'=>'warning',
                                'width' => 200,
                                'attribute' => 'cocina',
//                                        'htmlOptions' => array('tabindex' => "$cont"),
                                'onChange' => 'js:function($el, status, e){}'
                                    )
                            );
                            ?>

    <div class="row">
        <?php echo $form->labelEx($model, 'imagen'); ?>        <?php echo CHtml::activeFileField($model, 'imagen'); ?>  
        <?php echo $form->error($model, 'imagen'); ?></div>

    <?php if (!empty($model->imagen) && !$model->isNewRecord) { ?><div class="row"  style="border-style: solid;  padding: 3px;border-width:4px; width: 200px; border-color: #C5BCBC; background-color: #EEEEE0">
        <?php echo CHtml::image(Yii::app()->request->baseUrl . '/uploads/secciones/' . $model->imagen, "imagen", array('id' => 'target', "width" => 200)); ?>  
        </div>
    <?php } ?>

    <?php if ($model->isNewRecord || !$model->imagen) : ?><div class="row" style="border-style: solid;  padding: 3px;border-width:4px; width: 200px; border-color: #C5BCBC; background-color: #EEEEE0
             ">
                 <?php echo CHtml::image(Yii::app()->request->baseUrl . '/uploads/images/placeHolder.gif', "imagen", array('id' => 'target', "width" => 200)); ?>  
        </div>
    <?php endif; ?> 
    <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'cols' => 50)) ?>
    <div class="form-actions">
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType' => 'submit',
            'type' => 'primary',
            'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
        ));
        ?>
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            //'buttonType'=>'submit',
            'label' => Yii::t('AweCrud.app', 'Cancel'),
            'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
        ));
        ?>
    </div>

    <?php $this->endWidget(); ?>
</div>